Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NH-67864: use rubocop-performance #94

Merged
merged 3 commits into from
Nov 27, 2023
Merged

NH-67864: use rubocop-performance #94

merged 3 commits into from
Nov 27, 2023

Conversation

xuan-cao-swi
Copy link
Contributor

Description

Use rubocop-performance to find out the potential improvement of efficiency.

@xuan-cao-swi xuan-cao-swi requested a review from a team as a code owner November 24, 2023 22:40
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@@ -98,8 +98,7 @@ def for_log
# * Hash
#
def hash_for_log
@hash_for_log = {}
@hash_for_log = {trace_id: @trace_id, span_id: @span_id, trace_flags: @trace_flags, service_name: @service_name} if @do_log
@hash_for_log = @do_log ? {'trace_id' => @trace_id, 'span_id' => @span_id, 'trace_flags' => @trace_flags, 'resource.service.name' => @service_name} : {}
Copy link
Contributor

@cheempz cheempz Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, so seems this also fixes the minor problem you mentioned while reviewing the prerelease doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it fixed that issue.

@@ -181,7 +181,7 @@ def validate_token(token)
end

def validate_transform_service_name(service_name)
service_name = 'test_ssl_collector' if ENV['SW_APM_COLLECTOR'] =~ /java-collector:1222/
service_name = 'test_ssl_collector' if /java-collector:1222/.match?(ENV['SW_APM_COLLECTOR'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I question whether this line should actually be in the code, seems easy enough for testing setup to just specify a service name rather than pollute the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd agree. I removed all the logic related with java-collector.

Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice learning experience to read the changes, thanks @xuan-cao-swi! I left a few comments and also wondering if there was a hurdle to running it in a matrix of ruby versions?

@xuan-cao-swi
Copy link
Contributor Author

if there was a hurdle to running it in a matrix of ruby versions?

Yes, it seems like although the github action ran successfully, but the uploading the sarif output is problematic.

Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the revisit @xuan-cao-swi!

@xuan-cao-swi xuan-cao-swi merged commit f7073a9 into main Nov 27, 2023
12 checks passed
@xuan-cao-swi xuan-cao-swi deleted the NH-67864 branch November 27, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants